package com.l024.easyandroidlib.utils;

import io.reactivex.Maybe;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * rxjava工具类
 */
public class RxJavaUtil {
    public static <T> Single<T> commonObservable(Single<T> observable){
        return observable
                .subscribeOn(Schedulers.io());
    }

    public static <T> Maybe<T> commonObservable(Maybe<T> observable){
        return observable
                .subscribeOn(Schedulers.io());
    }


    public static <T> Observable<T> commonObservable(Observable<T> observable){
        return observable
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
